-
Notifications
You must be signed in to change notification settings - Fork 17.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plane: support off-board terrain navigation #26262
base: master
Are you sure you want to change the base?
Conversation
0e46f35
to
23efb73
Compare
I guess your radius's are turning out wrong because of the altitude scale we apply for constant load factor. ardupilot/libraries/AP_L1_Control/AP_L1_Control.cpp Lines 148 to 178 in 2a67cbe
There has been some discussion on this recently. I think the general view is that we should remove it (by default anyway) because it makes mission planning very unintuitive. |
Thanks @IamPete1, I'll try disabling. Update Confirmed - the scaling in float AP_L1_Control::loiter_radius(const float radius) const is the cause. |
- Extend to handle position as well as altitude. - Check for non-zero velocity and acceleration - Calculate and update loiter radius and direction. - Force update of adjust_altitude_target. - Disable debug output to GCS. Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
- Initial implementation forwards to GUIDED. - Add mode to parameters. - Send msg to GCS when switching to TERRAIN_NAVIGATION Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
- Copy npfg implementation from PX4 - Port npfg to ArduPilot - Replace tabs in npfg with whitespace - Change suffix in npfg header - Add NPFG instance to AP_Navigation adapter - Add parameters - Define static const variables in cpp - Update param group name Signed-off-by: Rhys Mainwaring <[email protected]>
- Add NPFG parameters - Add NPFG controller - Partially implement terrain navigation mode - Update set_position_target_global_int to use terrain navigation Signed-off-by: Rhys Mainwaring <[email protected]>
- Make getRollSetpoint const - Add method to set path tangent and implement some getters Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
- Enable roll slew rate - Disable gain scaling to avoid div zero error - Correct control interval calc - Set default track keeping to enable - Update slew rate to 90 deg / s Signed-off-by: Rhys Mainwaring <[email protected]>
- Ensure radius is reset in terrain navigation mode - Co-opt L1 nav controller for path following in terrain navigation mode - Correct position of loiter centre - Update curvature calculation - Correct tangent vector Signed-off-by: Rhys Mainwaring <[email protected]>
23efb73
to
80956f6
Compare
Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
- Implement method update_path - Update comment Signed-off-by: Rhys Mainwaring <[email protected]>
Signed-off-by: Rhys Mainwaring <[email protected]>
- Call ModeGuided _enter and _exit methods. - Use ModeGuided update method. - Store commanded curvature rather than radius. Signed-off-by: Rhys Mainwaring <[email protected]>
482770a
to
70ae8da
Compare
Signed-off-by: Rhys Mainwaring <[email protected]>
This is a proof-of-concept implementation of off-board control for ArduPlane for use with the terrain navigation library.
The implementation uses the
SET_POSITION_TARGET_GLOBAL_INT
mavlink message to match the interface provided by terrain_navigation and adds a custom guided mode (TERRAIN_NAVIGATION = Mode(26)
) to minimise the changes in current code. The longer term objective is to use the DDS interface and integrate more closely with the existing controller and guided mode.There are two choices of controller at compile time. Selection is by the variable in
mode_terrain_navigation.cpp
:Setting
ENABLE_NPFG_CONTROLLER
to 1 selects an experimental integration of the Nonlinear Path Following Guidance (NPFG) controller. Unfortunately this is not yet working correctly. The other approach co-opts the existing L1 controller to follow the Dubins path provided by the external controller.Interpreting setpoint information
The planner populates the fields of
SET_POSITION_TARGET_GLOBAL_INT
as follows:The position (
lat_int
,lon_int
,alt
) is the closest point on the planned Dubins path to the current vehicle location, where the vehicle location is provided to the planner by the flight controller using theGLOBAL_POSITION_INT
message. Thealt
is always provided asMAV_FRAME_GLOBAL_RELATIVE_ALT_INT
, so this is the only case handled.The horizontal velocity components (
vx
,vy
) comprise a unit vector tangential to the Dubins path at the closest point. The vertical component (vz
) is the desired climb rate along the flightpath.The horizontal acceleration components determine the desired path curvature. The path radius and direction are calculated from the lateral acceleration using
r = |v|^2 / |a_lat|
.If the acceleration is zero, the curvature is assumed to be zero (a radius of zero is interpreted as zero curvature).
terrain navigation mode
When using the L1 controller, the terrain navigation mode uses
update_loiter
if the curvature is non-zero (radius non-zero) andupdate_waypoint
if the curvature is zero (radius zero). When usingupdate_loiter
the setpoint position, tangent and turn radius are used to set a center_wp, turn radius and direction. When usingupdate_waypoint
the setpoint position and tangent are used to set a next_wp 50m ahead of the setpoint position.See also
Usage
In the following we assume the colcon workspace for the ROS 2 packages is called
ros2-aerial
.Build dependencies
Follow the instructions to set up ArduPilot for ROS 2 Humble.
Build and install the
ros2
branch ofterrain navigation
and any dependencies.Run
Launch ArduPilot SITL. This launch file simulates a quadplane in a park in Davosdorf.
Connect a mavproxy session to the running simulation:
Open the mission editor and load the misson:
Update a couple of parameters
Run the mission
The aircraft will takeoff then loiter indefinitely.
Launch mavros configured for ardupilot:
Launch the terrain planner:
Launch rviz:
Load Terrain
button.Interact
in the top tool bar.Update Start
.Update Goal
.A green circle will appear if the goal location is valid. A red circle indicates the goal location is not suitable.
Plan
.Engage Planner
.NAVIGATE
.In MAVProxy you should see the mode has switched to the custom mode (
Mode(26) = TERRAIN_NAVIGATION
)Testing
NPFG
Is not working as expected and is disabled.
L1
Is satisfactory, although the turns are not tight (the vehicle rate of turn is less than desired).
Figure: The vehicle turn is wider than the setpoint. The red arrow is the desired turn radius and direction. The blue arrow is the path tangent.
Figure: The final loiter circle is wider than the setpoint.
Figure: Logged flight path